----------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_logs/appendix_table5.log
  log type:  text
 opened on:  24 Jun 2022, 11:04:14

. 
.         use "$Rep_smokelabor/1_build/regdata/county_quarter.dta", clear 

.         
.         * drop labor outcomes 
.         drop *qwi* *lau* 

.         
.         * expand to industry groups 
.         sort countyfip rfrnc_qtros

.         gen _id = _n

.         expand 5 
(721,504 observations created)

.         bys _id: gen _industry=_n 

.         gen industry="."

.         local i = 0

.         foreach val in 111 112 113 114 115 {
  2.                 local i = `i'+1
  3.                 replace industry="`val'" if _industry==`i'
  4.         }
variable industry was str1 now str3
(180,376 real changes made)
(180,376 real changes made)
(180,376 real changes made)
(180,376 real changes made)
(180,376 real changes made)

.                                 
.         tab industry 

   industry |      Freq.     Percent        Cum.
------------+-----------------------------------
        111 |    180,376       20.00       20.00
        112 |    180,376       20.00       40.00
        113 |    180,376       20.00       60.00
        114 |    180,376       20.00       80.00
        115 |    180,376       20.00      100.00
------------+-----------------------------------
      Total |    901,880      100.00

.         drop _id _industry

.         destring industry, replace
industry: all characters numeric; replaced as int

.         
.         * merge agegrp-county-quarter qwi data 
.         merge 1:1 countyfip rfrnc_yr rfrnc_qtroy industry using "$Rep_smokelabor/1_build/qwi/proc/qwi_naics3_ag_county_quarterly
> .dta", keep(match master) nogen

    Result                           # of obs.
    -----------------------------------------
    not matched                       369,272
        from master                   369,272  
        from using                          0  

    matched                           532,608  
    -----------------------------------------

.                 
.         * per million conversion
.         gen pmil_qwi_emptotal = qwi_emptotal*1000000/seer_pop
(562,738 missing values generated)

.         
.         ** separate effects by industry groups 
.         egen g_industry=group(industry)

.         
.         local tbl_settings_log format(%6.3f) parentheses(stderr) asterisk()

.         local tbl_settings_pmil format(%6.1f) parentheses(stderr) asterisk()

.         local append replace

.         
.         forv grp =1/5 {
  2.         preserve    
  3.                 local col=`grp'+1
  4.                 keep if g_industry==`grp'
  5.                 tsset fe_countyqtroy rfrnc_yr
  6.                 
.                 * first diff: y(t) minus y(t-1)
.                 foreach v of varlist pmil_qwi_emptotal {
  7.                         gen d_`v'=`v'-L1.`v'
  8.                 }
  9.                 
.                 * emp ols 
.                 ivreghdfe d_pmil_qwi_emptotal (pm25=hms_deep)  [aw=seer_pop] , a(fe_countyqtroy fe_styr) cluster(countyfip)
 10.                 summ pmil_qwi_emptotal [aw=seer_pop] if e(sample)
 11.                 local ymean `r(mean)'
 12.                 regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table5.dta", addlabel(KleibergenPaap_F, `e(r
> kf)', outcome_mean, "`ymean'") table(col_`col', `tbl_settings_pmil') `append'
 13.                 local append append
 14.                                                 
.         restore         
 15.         }
(721,504 observations deleted)
       panel variable:  fe_countyqtroy (strongly balanced)
        time variable:  rfrnc_yr, 2006 to 2019
                delta:  1 unit
(84,424 missing values generated)
(dropped 273 singleton observations)
(sum of wgt is     1.2439e+10)
(MWFE estimator converged in 9 iterations)

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on countyfip

Number of clusters (countyfip) =   1251               Number of obs =    50816
                                                      F(  1,  1250) =     8.33
                                                      Prob > F      =   0.0040
Total (centered) SS     =  6.38214e+10                Centered R2   =  -0.0002
Total (uncentered) SS   =  6.38214e+10                Uncentered R2 =  -0.0002
Residual SS             =  6.38334e+10                Root MSE      =     1128

------------------------------------------------------------------------------
             |               Robust
d_pmil_qwi~l |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pm25 |  -44.23909   15.33163    -2.89   0.004    -74.31765   -14.16053
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):            129.188
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             2003.701
                         (Kleibergen-Paap rk Wald F statistic):        159.954
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):         0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         pm25
Excluded instruments: hms_deep
Partialled-out:       _cons
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------+
    Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------+---------------------------------------|
 fe_countyqtroy |      4861        4861           0    *|
        fe_styr |       618           0         618     |
--------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
pmil_qwi_e~l |  50,816  1.2439e+10    2463.967   8277.819          0   361503.5
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved
(721,504 observations deleted)
       panel variable:  fe_countyqtroy (strongly balanced)
        time variable:  rfrnc_yr, 2006 to 2019
                delta:  1 unit
(89,470 missing values generated)
(dropped 250 singleton observations)
(sum of wgt is     1.0408e+10)
(MWFE estimator converged in 12 iterations)

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on countyfip

Number of clusters (countyfip) =   1122               Number of obs =    43921
                                                      F(  1,  1121) =     0.20
                                                      Prob > F      =   0.6548
Total (centered) SS     =   2647172175                Centered R2   =   0.0001
Total (uncentered) SS   =   2647172175                Uncentered R2 =   0.0001
Residual SS             =   2647005169                Root MSE      =    247.2

------------------------------------------------------------------------------
             |               Robust
d_pmil_qwi~l |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pm25 |   .6988136   1.562336     0.45   0.655    -2.366619    3.764246
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):            112.804
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             1954.828
                         (Kleibergen-Paap rk Wald F statistic):        134.309
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):         0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         pm25
Excluded instruments: hms_deep
Partialled-out:       _cons
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------+
    Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------+---------------------------------------|
 fe_countyqtroy |      4374        4374           0    *|
        fe_styr |       610           0         610     |
--------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
pmil_qwi_e~l |  43,921  1.0408e+10    735.7729    2194.22   1.916594   118896.8
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved
(721,504 observations deleted)
       panel variable:  fe_countyqtroy (strongly balanced)
        time variable:  rfrnc_yr, 2006 to 2019
                delta:  1 unit
(139,821 missing values generated)
(dropped 298 singleton observations)
(sum of wgt is     3.3038e+09)
(MWFE estimator converged in 14 iterations)

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on countyfip

Number of clusters (countyfip) =    589               Number of obs =    19841
                                                      F(  1,   588) =     0.74
                                                      Prob > F      =   0.3891
Total (centered) SS     =    659999294                Centered R2   =   0.0006
Total (uncentered) SS   =    659999294                Uncentered R2 =   0.0006
Residual SS             =  659624570.9                Root MSE      =    184.5

------------------------------------------------------------------------------
             |               Robust
d_pmil_qwi~l |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pm25 |   1.613484   1.871891     0.86   0.389    -2.062922    5.289889
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             54.812
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             2197.482
                         (Kleibergen-Paap rk Wald F statistic):        138.517
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):         0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         pm25
Excluded instruments: hms_deep
Partialled-out:       _cons
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------+
    Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------+---------------------------------------|
 fe_countyqtroy |      2204        2204           0    *|
        fe_styr |       465           0         465     |
--------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
pmil_qwi_e~l |  19,841  3.3038e+09    437.5429   1091.734          0   32809.81
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved
(721,504 observations deleted)
       panel variable:  fe_countyqtroy (strongly balanced)
        time variable:  rfrnc_yr, 2006 to 2019
                delta:  1 unit
(174,834 missing values generated)
(dropped 69 singleton observations)
(sum of wgt is     2.8086e+09)
(MWFE estimator converged in 12 iterations)

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on countyfip

Number of clusters (countyfip) =    113               Number of obs =     3582
                                                      F(  1,   112) =     0.20
                                                      Prob > F      =   0.6586
Total (centered) SS     =  11532129.43                Centered R2   =  -0.0004
Total (uncentered) SS   =  11532129.43                Uncentered R2 =  -0.0004
Residual SS             =  11536314.35                Root MSE      =    58.93

------------------------------------------------------------------------------
             |               Robust
d_pmil_qwi~l |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pm25 |  -.7264129   1.639906    -0.44   0.659    -3.975676     2.52285
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             21.366
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):              159.716
                         (Kleibergen-Paap rk Wald F statistic):         15.065
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):         0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         pm25
Excluded instruments: hms_deep
Partialled-out:       _cons
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------+
    Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------+---------------------------------------|
 fe_countyqtroy |       423         423           0    *|
        fe_styr |       259           0         259     |
--------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
pmil_qwi_e~l |   3,582  2.8086e+09    98.95074    321.853   1.270132   6464.101
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved
(721,504 observations deleted)
       panel variable:  fe_countyqtroy (strongly balanced)
        time variable:  rfrnc_yr, 2006 to 2019
                delta:  1 unit
(112,497 missing values generated)
(dropped 305 singleton observations)
(sum of wgt is     1.1184e+10)
(MWFE estimator converged in 9 iterations)

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on countyfip

Number of clusters (countyfip) =   1082               Number of obs =    38634
                                                      F(  1,  1081) =     1.29
                                                      Prob > F      =   0.2566
Total (centered) SS     =  2.10777e+11                Centered R2   =   0.0013
Total (uncentered) SS   =  2.10777e+11                Uncentered R2 =   0.0013
Residual SS             =  2.10504e+11                Root MSE      =     2353

------------------------------------------------------------------------------
             |               Robust
d_pmil_qwi~l |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pm25 |  -26.85632   23.65899    -1.14   0.257    -73.27906    19.56642
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):            118.805
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             1718.447
                         (Kleibergen-Paap rk Wald F statistic):        140.548
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):         0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         pm25
Excluded instruments: hms_deep
Partialled-out:       _cons
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------+
    Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------+---------------------------------------|
 fe_countyqtroy |      4098        4098           0    *|
        fe_styr |       614           0         614     |
--------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
pmil_qwi_e~l |  38,634  1.1184e+10    2462.822   12292.92          0   352366.7
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved

.                                 
.         use "$Rep_smokelabor/2_analysis/output_tables/appendix_table5.dta", replace

.         drop if var == "r2"
(1 observation deleted)

.         drop if var == "_id"
(0 observations deleted)

.         drop if strpos(var, "_cons_") > 0
(0 observations deleted)

.         ingap 3

.         noisily list , sep(0)

     +----------------------------------------------------------------+
     |              var      col_2    col_3    col_4   col_5    col_6 |
     |----------------------------------------------------------------|
  1. |        pm25_coef   -44.2***      0.7      1.6    -0.7    -26.9 |
  2. |      pm25_stderr     (15.3)    (1.6)    (1.9)   (1.6)   (23.7) |
  3. |                                                                |
  4. |                N     50,816   43,921   19,841   3,582   38,634 |
  5. | KleibergenPaap_F      160.0    134.3    138.5    15.1    140.5 |
  6. |     outcome_mean     2464.0    735.8    437.5    99.0   2462.8 |
     +----------------------------------------------------------------+

.         saveold "$Rep_smokelabor/2_analysis/output_tables/appendix_table5.dta", replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata formats)
file C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_tables/appendix_table5.dta saved

. 
. log close
      name:  <unnamed>
       log:  C:\Users\ericzou\Dropbox\replicate_smokelabor/2_analysis/output_logs/appendix_table5.log
  log type:  text
 closed on:  24 Jun 2022, 11:04:42
----------------------------------------------------------------------------------------------------------------------------------
